//
//  DeviceUtil.m
//  AFNetworking
//
//  Created by Henry on 2023/2/13.
//

#import "DeviceUtil.h"
#define  filterContent @"Siter"

@interface DeviceUtil()
@end
@implementation DeviceUtil

+ (BOOL)shouldAddToSource:(Peripheral *)device withArrary:(nonnull NSMutableArray *)source{
    // Check filter
    if (!device.name || ![device.name hasPrefix:filterContent]) {
        // The device name has no filter prefix
        return NO;
    }
    
    // Check exist
    for (int i = 0; i < source.count; i++) {
        Peripheral *existDevice = source[i];
        if ([device.uuid isEqual:existDevice.uuid]) {
            // The device exists in source already
            return NO;
        }
    }
    
    return YES;
}

@end
